from selenium.webdriver.common.by import By

from common.Utils import ForumDriver
#测试帖子详情页
class ForumDetail:
    url = ""
    driver = ""
    def __init__(self):
        self.url = "http://127.0.0.1:9580/index.html"
        self.driver = ForumDriver.driver
        self.driver.get(self.url)

    #登陆状态下帖子详情页的测试
    def DetailTestByLogin(self):
        self.driver.find_element(By.CSS_SELECTOR,"#artical-items-body > div:nth-child(1) > div > div.col > div.text-truncate > a > strong").click()
        #检查点赞
        self.driver.find_element(By.CSS_SELECTOR,"#details_btn_like_count")
        #检查个人中心是否存在
        self.driver.find_element(By.CSS_SELECTOR,"#article_details_author_name")
        # 检查内容是否存在
        self.driver.find_element(By.CSS_SELECTOR, "#details_article_content_title")
        #检查回复功能是否存在
        self.driver.find_element(By.CSS_SELECTOR,"#bit-forum-content > div.page-body > div > div > div:nth-child(4) > div > div.card-footer.bg-transparent.mt-auto > div > div > div")
        # 测试发送私信功能是否存在
        self.driver.find_element(By.CSS_SELECTOR, "#btn_details_send_message")
        #屏幕截图
        ForumDriver.getScreeShot()